package com.apes.fn.server.productRequire;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.party.model.PartyRole;
import com.apes.scm.masterdata.product.model.Product;
import com.apes.scm.masterdata.product.model.ProductUom;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = ProductRequireExpand.CONST_TABLE_NAME)
public class ProductRequireExpand extends BaseModel {
    public static final String CONST_TABLE_NAME = "stock_product_require_expand";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, padding = 1, name = "自动转储扩展表")
    private String id;

    @Column(name = "origin")
    @Comment("原始单号")
    private String origin;

    @Column(name = "origin_item_id")
    @Comment("原始明细编码")
    private String originItemId;

    @Column(name = "origin_business_type", length = 32)
    @Comment("源单据类型")
    private String originBusinessType;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "product_id", referencedColumnName = "id", nullable = false)
    @Comment("商品编码")
    private Product productId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "product_uom_id", referencedColumnName = "id", nullable = false)
    @Comment("计量单位")
    private ProductUom productUomId;

    @Column(name = "distribution_id")
    @Comment("配货单号")
    private String distributionId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "distribution_company_id", referencedColumnName = "id")
    @Comment("配货单公司")
    private PartyRole distributionCompany;

    @Column(name = "require_qty", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("原始数量")
    private double requireQty = 0;

    @Column(name = "assign_qty", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("分配数量")
    private double assignQty = 0;

    @Column(name = "ship_qty", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("发货数量")
    private double shipQty = 0;

    @Column(name = "cancel_qty", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("取消数量")
    private double cancelQty = 0;

    @Column(name = "arrive_qty", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("到货数量")
    private double arriveQty = 0;

    @Comment("到货日期")
    @Column(name = "arrive_date")
    private Date arriveDate;
}





























